const https = require('https');
const http = require('http');
const request = require('request');

const querystring = require("querystring");
const quryParamters = querystring.stringify({ coin: 'btc' });


function fetchTicker(platform, url, callback) {

    const options = {
        url: url,
        method: 'GET',
        headers: {
            'Content-Type': 'application/json',
            // 'Content-Length': Buffer.byteLength(postData)
        }
    };

    function onResponse(error, response, body) {
        if (!error && response.statusCode == 200) {
            let ticker = JSON.parse(body)
            callback(platform, ticker)
        }
    }

    request(options, onResponse);
}
// 0.853+0.86 = 1.713
// fetchTicker();

exports.fetchTicker = fetchTicker

